import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * This is the class denoting a task that will be handled by the employee system. Actually,
 * it is just an extended version of the goal. The reason why we do this is that it will
 * be used in TaskGraph, thus some features should be added.
 * 
 * @author zhongnanhai
 *
 */
public class Task implements Cloneable{
	/**Task name*/
	private String name;
	/**Task description*/
	private String description;
	/**Task size*/
	private float size;
	/**The pre-task that should be implemented/completed before this task*/
	private List<Task> preTasks = new ArrayList<Task>();
	/**Is this task node a terminal node or not.*/
	private boolean terminal;
	/**Which employee will complete this task.*/
	private Employee assignedEmployee;
	/**If this task has been allocated or not*/
	private boolean allocated = false;
	/**The type of this task;We assume that a task just has a task type here.*/
	private int taskType;
	/**The role this task needs;We assume that a task just needs a role here.*/
	private int role;
	/**The task is finished or not*/
	private boolean finished = false;
	/**The begin date and end date; if this task can not be executed by anyone
	 * then null.*/
	private Date begin=null,end=null;

	public List<Task> getPreTasks() {
		return preTasks;
	}
	public void setPreTasks(ArrayList<Task> pretasks){
		this.preTasks = pretasks;
	}
	/**
	 * Set the begin date and end date between which this task will be executed
	 * @param begin begin date to process this task
	 * @param end end date to finish this task
	 */
	public void setCompletionTime(Date begin,Date end){
		this.begin = begin;
		this.end = end;
	}
	public Date getBeginDate(){return this.begin;}
	public Date getEndDate(){return this.end;}
	public void addPreTask(Task preTask) {
		this.preTasks.add(preTask);
	}
	public boolean isTerminal() {
		return terminal;
	}

	public void setTerminal(boolean terminal) {
		this.terminal = terminal;
	}

	public Employee getAssignedemployee() {
		return assignedEmployee;
	}

	public void setAssignedemployee(Employee assignedEmployee) {
		this.assignedEmployee = assignedEmployee;
	}

	public boolean isAllocated() {
		return allocated;
	}

	public void setAllocated(boolean allocated) {
		this.allocated = allocated;
	}

	public int getTaskType() {
		return taskType;
	}

	public void setTaskType(int taskType) {
		this.taskType = taskType;
	}

	public int getRole() {
		return role;
	}

	public void setRole(int role) {
		this.role = role;
	}
	public boolean isFinished() {
		return finished;
	}
	public void setFinished(boolean finished) {
		this.finished = finished;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public float getSize() {
		return size;
	}
	public void setSize(float size) {
		this.size = size;
	}
	public Object clone(){
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			// TODO Auto-generated catch block
			throw new InternalError();
		}
	}
	
}
